package network1;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class UDPSever {
    public static void main(String[] args) throws IOException {
        System.out.println("接收方已启动");
        DatagramSocket Socket = new DatagramSocket(9999);
        byte[] bytes = new byte[1024 * 60];
        DatagramPacket Packet = new DatagramPacket(bytes, 0, bytes.length);
        Socket.receive(Packet);
        byte[] data = Packet.getData();

        int length = Packet.getLength();
        System.out.println("new String(data,0,length) = " + new String(data, 0, length));
        Socket.close();


    }
}
